$(document).ready(function() {
  getProductDetial();
})


function getProductDetial(){
	
	var productId=getQueryString("id");
	
	var params={
		"id":productId
	}
	
	
	My.ajax2("../api/product/getProductDetail.jhtml", params, function fillTypes(index) {
    $("#productName").empty();
    $("#productName").append("<h3>"+index.productPO.product_name+"</h3>");
    $("#price").empty();
    $("#price").append("$"+index.productPO.discount_price+"<span>$"+index.productPO.full_price+"</span>");
    $("#mainUrl").attr('src',picUrl+index.productPO.main_url);
  
    var imgList=index.imgList;
    if (imgList.length>0) {
    	for(var i = 0; i < imgList.length; i++) {
    	var imgUrl = "imgUrl" + (i + 1);
    	$("#" + imgUrl).attr('src',picUrl+imgList[i].pic_url);

      }
    }
    
    
    
    
    
    
  
  
    //详情
    $("#description").append("<p>"+index.productPO.discription+"</p>");  
  
  
    //参数
    var paramList=index.paramList;
    for (var i = 0; i < paramList.length; i++) {
    	 $("#paramKeyValue").append("<tr><td>"+paramList[i].param_key+"</td><td>"+paramList[i].param_value+"</td></tr>");
    }
    
    //提问
    var faqList=index.faqList;
    for (var i = 0; i < faqList.length; i++) {
       $("#faq").append("<h5>"+faqList[i].question +"</h5><p>"+ faqList[i].answer+"</p>");
    }
          
		
	})
	
	
	
	
	
	
	
}





